<template>
	<view class="content">
		<!-- 顶部文字 -->
		<view style="height: 160px;width: 100%;">
			<view style="width:140px;height:140px;margin-left:calc(50% - 70px);margin-top:10px;border-radius: 100%;">
			<image src="../../static/logo.png" style="width: 100%;border-radius: 50%;"></image>
			</view>
			<text class="title" style="margin-top: 30px;">{{typeShow}}</text>
		</view>
		<view class="loginTitle">用户登录</view>
		<input class="input-box" :inputBorder="false" v-model="registerForm.userName" placeholder="请输入账号"/>
		<input type="password" class="input-box" :inputBorder="false" v-model="registerForm.password" placeholder="请输入密码"/>

		<uni-agreements @setAgree="agree = $event"></uni-agreements>
		<button style="background-color: #38628E;border-radius: 30px;" class="send-btn" type="primary"
			@click="pwdLogin">登&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;录</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				registerForm:{
					userName:null,
					password:null,
				}
			}
		},
		computed: {
		},
		methods: {
			pwdLogin(){
				this.fetch.request('/wxmini/login', 'POST', {
					userName: this.registerForm.userName,
					password: this.registerForm.password,
				}, false, true, false).then(res => {
					
					if (res.code == 200) {
						uni.setStorageSync("token", encodeURIComponent(res.data.token ));
						uni.setStorageSync("shopId", res.data.shopId );
						uni.setStorageSync("shopName", res.data.shopName );
						uni.setStorageSync("shopEndDate", res.data.shopEndDate );
						uni.redirectTo({
							url: '../home/home'
						})
					}else{
						uni.showModal({
							title: '提示',
							content: res.msg,
							success: function (res) {
							}
						});
					}
				}).catch(error => {
					console.log(error)
				})
				
				
			},
			/* 前往注册 */
			toRegister(e) {
				uni.redirectTo({
					url: '../regist/regist'
				})
			}
		}
	}
</script>

<style>
	.loginTitle{
		font-weight: bold;
		font-size: 17px;
		margin-bottom: 30px;
	}
	page{
		background-color: #F9F9F9;
	}
	view {
		display: flex;
		box-sizing: border-box;
		flex-direction: column;
	}
	.content {
		padding: 0 50rpx;
		width: 750rpx;
		flex: 1;
	}
	
	.input-box {
		padding: 0 15px;
		margin-bottom: 10px;
		background-color: #EEEEEE;
		border-radius: 50px;
	}
	
	.get-code {
		margin: 0;
		margin-top: 15px;
		background-color: #007aff;
		color: #F9F9F9;
	}
	
	.input-box,
	.get-code {
		height: 40px;
		line-height: 40px;
	}
	
	.title {
		text-align: center;
		padding-bottom: 5px;
	}
	
	.tip {
		color: #666666;
		font-size: 26rpx;
		margin: 6px 0;
	}
	
	.easyinput {
		background-color: #F8F8F8;
		border-radius: 6rpx;
	}
	
	.send-btn {
		width: 100%;
		margin-top: 15px;
		border-radius: 6rpx;
	}
	
	.link {
		color:#007AFF;
	}

/* 	.auth-box {
		flex-direction: row;
		justify-content: space-between;
		margin-top: 20px;
	}

	.auth-box{
		font-size: 26rpx;
	} */

	.login-text-sub {
		color: #8a8f8b;
	}

	.toRegister {
		margin-top: 80px;
		width: 600rpx;
	}
	.captcha-box{
		flex-direction: row;
		align-items: center;
		justify-content: flex-end;
	}
	.captcha-img{
		margin: 0 15px 10px 0;
		width: 250rpx;
	}
	.captcha{
		width: 350rpx;
	}
</style>
